package com.zhang.yygh.sms.controller;

import com.zhang.yygh.common.result.R;
import com.zhang.yygh.sms.service.SMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/sms")
public class SMSController {

    @Autowired
    private SMSService smsService;

    @GetMapping(value = "/send/{phone}")
    public R sendCode(@PathVariable String phone){
        boolean flag=smsService.sendCode(phone);
        if (flag){
            return R.ok();
        }else {
            return R.error();
        }
    }
}
